﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Catering.Catering_Page.richang
{
    public partial class DailyMoonwf : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        [System.Web.Services.WebMethod]
        public static System.Collections.ArrayList GetMoonForDropDownList()
        {
            Catering_Rules.Moon _moonrules = new Catering_Rules.Moon();
            var listmoon = _moonrules.GetModelList("");
            System.Collections.ArrayList al = new System.Collections.ArrayList();
            foreach (var item in listmoon)
            {
                al.Add(item.Id + "," + item.MoonName);
            }
            return al;
        }

        /// <summary>
        /// 新增
        /// 编写：章建国
        /// </summary>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static string Add(string _WoJu, string _CanJu, string _Rice, string _Surfice, string _Oil, string _DishDate, 
            string _CheckDate, string _IsCommunicate, string _Area, string _Oilstove, string _SmokeMachineWash, 
            string _FireExtinguisher, string _FireBlanket, string _HighRiskEqui)
        {
            string mes = "error";
            Catering_Model.DailyMoon _model = new Catering_Model.DailyMoon();
            Catering_Rules.DailyMoon dailymoon = new Catering_Rules.DailyMoon();
            #region 参数赋值
            _model.WoJu = Convert.ToInt32(_WoJu);
            _model.CanJu = Convert.ToInt32(_CanJu);
            _model.Rice = Convert.ToDecimal(_Rice);
            _model.Surfice = Convert.ToDecimal(_Surfice);
            _model.Oil = Convert.ToDecimal(_Oil);
            _model.DishDate = Convert.ToDateTime(_DishDate);
            _model.CheckDate = Convert.ToDateTime(_CheckDate);
            _model.IsCommunicate = _IsCommunicate == "是" ? true : false;
            _model.Area = Convert.ToDecimal(_Area);
            _model.Oilstove = Convert.ToDecimal(_Oilstove);
            _model.SmokeMachineWash = Convert.ToInt32(_SmokeMachineWash);
            _model.FireExtinguisher = Convert.ToInt32(_FireExtinguisher);
            _model.FireBlanket = Convert.ToInt32(_FireBlanket);
            _model.HighRiskEqui = Convert.ToInt32(_HighRiskEqui);
            #endregion 参数赋值
            if (dailymoon.Add(_model) > 0)
            {
                mes = "ok";
            }
            return mes;
        }
    }
}